<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/hero.css">
    <script>
        //practice1
        function random_print(arr){
            let rand_index = Math.floor(Math.random()*arr.length)
            console.log(arr.splice(rand_index,1)[0])
            console.log(arr)
        }
        let arr1 = ['老赵','老李','小传','小黑']
        // random_print(arr1)
        
        //practice2
        let per ={
            sex: 'nan',
            age: 18,
            hobby: 'basketball',
            say: function(){
                console.log(`大家好，我叫${this.sex}，我今年${this.age}，我最爱的运动是${this.hobby}`)
            },
            eat: function(){
                console.log("我最喜欢吃饭！")
            }
        }
        // console.log(per.age)
        // per.say()
        // console.log(per['hobby'])
        // per.eat()
        // let shuxing1 = 'fruit'
        // let shuxing1zhi = 'apple'
        // per[shuxing1] =shuxing1zhi
        // console.log(per)
        // shuxing1zhi = '111'
        // console.log(per)

        //practice3
        //同上

        //扩展
        let datas = [
        { name: '司马懿', imgSrc: '01.jpg' },
        { name: '女娲', imgSrc: '02.jpg' },
        { name: '百里守约', imgSrc: '03.jpg' },
        { name: '亚瑟', imgSrc: '04.jpg' },
        { name: '虞姬', imgSrc: '05.jpg' },
        { name: '张良', imgSrc: '06.jpg' },
        { name: '安其拉', imgSrc: '07.jpg' },
        { name: '李白', imgSrc: '08.jpg' },
        { name: '阿珂', imgSrc: '09.jpg' },
        { name: '墨子', imgSrc: '10.jpg' },
        { name: '鲁班', imgSrc: '11.jpg' },
        { name: '嬴政', imgSrc: '12.jpg' },
        { name: '孙膑', imgSrc: '13.jpg' },
        { name: '周瑜', imgSrc: '14.jpg' },
        { name: 'XXX', imgSrc: '15.jpg' },
        { name: 'XXX', imgSrc: '16.jpg' },
        { name: 'XXX', imgSrc: '17.jpg' },
        { name: 'XXX', imgSrc: '18.jpg' },
        { name: 'XXX', imgSrc: '19.jpg' },
        { name: 'XXX', imgSrc: '20.jpg' }
        ]
        let str = null
        for (let i =0; i < datas.length;i++){
            let picture_name = null
            if (i<9){
                picture_name = '0'+(i+1) 
            }else{
                picture_name = i+1
            }
            let name = datas[i].name 
            
            str += `<li><img src="uploads/heros/${picture_name}.jpg" title="${name}"></li>`
        }
        
        document.write(`
		<ul class="list">
			${str}
		</ul>
		`)
    </script>
</head>
<body>
    
        
    
</body>
</html>